<%@ page language="java" import="java.util.*,net.sf.json.JSONArray,net.sf.json.JSONObject" pageEncoding="utf-8"%>
<%@ include file="/WEB-INF/view/common/kendocommon.jsp"%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
		<meta charset="utf-8">
		<meta name="viewport" content="width=device-width" />
		<title>会员消费登记单</title>
		<link rel="stylesheet" href="${basepath}/css/style.css" />
		<script src="${basepath}/js/LodopFuncs.js"></script>
		
		
		<%String baby_name=request.getParameter("baby_name");
		String real_name=request.getParameter("real_name");
		String phone=request.getParameter("phone");
		String member_number=request.getParameter("member_number");
		String item=request.getParameter("item");
		String isReload=request.getParameter("isReload");	
		
		
		
		JSONArray items = JSONArray.fromObject(item);
		// 读取金额
		for (int i = 0; i < items.size(); i++) {
			JSONObject jsonObject = items.getJSONObject(i);
			String name=String.valueOf(jsonObject.get("name"));
			System.out.println(name);
		}
		%>
		<script>
		
	       $(document).ready(function() {
	    	   console.log('ready');
	    	 //alert('xxxxxx');
	    	   var time = new Date().format("yyyy-MM-dd hh:mm");
	    	   $('#curDate').html(time);
				window.print();
			//	parent.reload1();
				//myPrint();
				
			//	parent.reload1();
	       })
	       var LODOP;
	     		function myPrint(){
			//debugger;
	        	LODOP=getLodop();         
		   		LODOP.PRINT_INIT("打印测试");	
		   		//LODOP.SET_PRINT_PAGESIZE(3,58mm,document.getElementById("textarea01").offsetHeight,"");		
		   		LODOP.SET_PRINT_PAGESIZE(3,580,40,"");	
				LODOP.ADD_PRINT_HTM(10,5,"100%","100%",document.getElementById("memberConsumeRecord").innerHTML);
				
				LODOP.PRINT();
				
				
				parent.reload1();
				
			//	if (LODOP.SET_PRINTER_INDEXA("GP-58130M Series")) {
		//		LODOP.PRINT();
		//	}
	//		else
	//				{
	//			alert("请准备好GP-58130M Series热敏打印机");
	//				}
	    	}
		</script>
	</head>
	<body>
		<!--head-->
		<div id='head' class="clearfix">
		    <div class="t1">
		        <span>会员消费登记单</span>
		    </div>
		    <div class="t2 clearfix">
		        <div class="f_l">
		            <span>日期：</span>
		            <span id="curDate"></span>
		        </div>
		        <div class="f_r">
		            <span>会员号：</span>
		            <span id='mem_id'><%=member_number%></span>
		        </div>
		    </div>
		</div>
		<!--mod-->
		<div class="mod" id="memberConsumeRecord">
		    <div class="mod_1 bline clearfix">
		        <div class="caption">会员信息</div>
		        <div class="baby_info">
		            <ul class="clearfix">
		                <li>
		                    <span>用户姓名：</span>
		                    <input type="text" id="baby_name" name="baby_name" class="bn" value="<%=real_name %>" />
		                </li>
		            </ul>
		            <ul class="clearfix">
		                <li>
		                    <span>用户手机：</span>
		                    <input type="text" id="baby_name" name="baby_name" class="bn" value="<%=phone %>" />
		                </li>
		            </ul>
		        </div>
		    </div>
		    <div class="mod_3 bline clearfix">
		        <div class="caption">消费清单</div>
		        <div class="package_info mt5">
		            <table id="tb_package" border="1" cellspacing="0" cellpadding="0">
		                <tr class="header">
		                    <td>项目明细</td>
		                    <td>单价</td>
		                    <td>数量</td>
		                    <td>金额</td>
		                </tr>
		                <tr class="content">
		                    <td>
		                        <ul id="ul_items">
<% 
		  for (int i = 0; i < items.size(); i++) {
			JSONObject jsonObject = items.getJSONObject(i);
			String name=String.valueOf(jsonObject.get("name"));
			%>
			<li class="clearfix"><%=name %></li>
			<% 

		}
 %>              

		                        </ul>
		                    </td>
		                    <td>
		                        <ul id="ul_uPrice">
<% 
		  for (int i = 0; i < items.size(); i++) {
			JSONObject jsonObject = items.getJSONObject(i);
			String unit_price=String.valueOf(jsonObject.get("unit_price"));
			%>
			<li class="clearfix"><%=unit_price %></li>
			<% 

		}
 %>      
		                        </ul>
		                    </td>                    
		                    <td>
		                        <ul id="ul_count">
<% 
		  for (int i = 0; i < items.size(); i++) {
			JSONObject jsonObject = items.getJSONObject(i);
			String quantity=String.valueOf(jsonObject.get("quantity"));
			%>
			<li class="clearfix"><%=quantity %></li>
			<% 

		}
 %>      
		                        </ul>
		                    </td>
		                    <td>
		                        <ul id="ul_RMB">
<% 
		  for (int i = 0; i < items.size(); i++) {
			JSONObject jsonObject = items.getJSONObject(i);
			String amount=String.valueOf(jsonObject.get("amount"));
			%>
			<li class="clearfix"><%=amount %></li>
			<% 

		}
 %>      
		                        </ul>
		                    </td>
		                </tr>
		            </table>
		        </div>
		    </div>
		

		
		    <div class="mod_5 bline clearfix">
		        <div class="caption">补充信息</div>
		        <div class="add_info mt5">
		            <p><span>备注：</span></p>
		            <div class="note_div t_l">
		                <textarea name="note_text" rows="5" cols="40">
		                    
		                </textarea>
		            </div>
		        </div>
		    </div>
		    <div class="mod_6 bline clearfix">
		        <div class="f_l">
		            <p>
		                <span>经办人签字：</span>
		                <input type="text" name="operator_signature" id="operator_signature" value="" />
		                <span>审核人签字：</span>
		                <input type="text" name="auditor_signature" id="auditor_signature" value="" />
		            </p>
		        </div>
		        <div class="f_r">
		            <p>
		                <span>客户签字：</span>
		                <input type="text" name="customer_signature" id="customer_signature" value="" />
		            </p>
		        </div>
		    </div>
		</div>		
	</body>
</html>
